package org.third.integration.etcd.bean;

import java.util.List;

public class KubeEtcdResponse {
	//When Error 
	private String errorCode;
	private String message;
	private String cause;
	private String index;

	//When Success
	private String action;
	private Node node;
	
	public static class Node {
		private String key;
		private String value;
		private boolean dir;
		private List<Node> nodes;
		private String modifiedIndex;
		private String createdIndex;
		public String getKey() {
			return key;
		}
		public void setKey(String key) {
			this.key = key;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
		public boolean isDir() {
			return dir;
		}
		public void setDir(boolean dir) {
			this.dir = dir;
		}
		public List<Node> getNodes() {
			return nodes;
		}
		public void setNodes(List<Node> nodes) {
			this.nodes = nodes;
		}
		public String getModifiedIndex() {
			return modifiedIndex;
		}
		public void setModifiedIndex(String modifiedIndex) {
			this.modifiedIndex = modifiedIndex;
		}
		public String getCreatedIndex() {
			return createdIndex;
		}
		public void setCreatedIndex(String createdIndex) {
			this.createdIndex = createdIndex;
		}
		@Override
		public String toString() {
			return "Node [key=" + key + ", value=" + value + ", dir=" + dir
					+ ", nodes=" + nodes + ", modifiedIndex=" + modifiedIndex
					+ ", createdIndex=" + createdIndex + "]";
		}
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getCause() {
		return cause;
	}

	public void setCause(String cause) {
		this.cause = cause;
	}

	public String getIndex() {
		return index;
	}

	public void setIndex(String index) {
		this.index = index;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public Node getNode() {
		return node;
	}

	public void setNode(Node node) {
		this.node = node;
	}

	@Override
	public String toString() {
		return "EtcdResponse [errorCode=" + errorCode + ", message=" + message
				+ ", cause=" + cause + ", index=" + index + ", action="
				+ action + ", node=" + node + "]";
	}
	
}


//example
//	{
//	  "action": "get",
//	  "node": {
//	    "key": "/suite-installer/suite-instances",
//	    "dir": true,
//	    "nodes": [
//	      {
//	        "key": "/suite-installer/suite-instances/1477572579729",
//	        "value": "vvv",
//	        "modifiedIndex": 172930,
//	        "createdIndex": 172930
//	      },
//	      {
//	        "key": "/suite-installer/suite-instances/1477573339117",
//	        "value": "vvv",
//	        "modifiedIndex": 173006,
//	        "createdIndex": 173006
//	      }
//	    ],
//	    "modifiedIndex": 172930,
//	    "createdIndex": 172930
//	  }
//	}